#6 ✓resolved
Rick DeNatale

Occurence enumeration should preserve type of datetimes

Reported by Rick DeNatale | May 21st, 2009 @ 05:16 PM | in 0.0.9

This came out of a question from Bruno in response to Ticket #3

In attempting to understand his problem I wrote this test program

require 'rubygems'
require 'ri_cal'

cal = RiCal.parse_string <<ENDCAL
BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
VERSION:2.0
BEGIN:VEVENT
CREATED:20090520T091929Z
LAST-MODIFIED:20090520T092025Z
DTSTAMP:20090520T091929Z
UID:36197790-cf15-4aba-9213-f61d434c4cd8
SUMMARY:event1
DTSTART;VALUE=DATE:20090601
DTEND;VALUE=DATE:20090602
TRANSP:TRANSPARENT
END:VEVENT
BEGIN:VEVENT
CREATED:20090520T092032Z
LAST-MODIFIED:20090520T092052Z
DTSTAMP:20090520T092032Z
UID:d41c124a-65c3-400e-bd04-1d2ee7b98352
SUMMARY:event2
RRULE:FREQ=MONTHLY;INTERVAL=1
DTSTART;VALUE=DATE:20090603
DTEND;VALUE=DATE:20090604
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
ENDCAL
puts "occurrences of first event:"
cal.first.events.first.occurrences(:after => Date.parse('01/01/1990'), :before => Date.parse("01/01/2010")).each  do|occur|
  puts "#{occur.dtstart} which is a #{occur.dtstart.class}"
end
puts "\noccurrences of second event"
cal.first.events[1].occurrences(:after => Date.parse('01/01/1990'), :before => Date.parse("01/01/2010")).each do |occur| 
  puts "#{occur.dtstart} which is a #{occur.dtstart.class}"
end

which produces the following output:

occurrences of first event: 2009-06-01 which is a Date

occurrences of second event 2009-06-03T00:00:00+00:00 which is a DateTime 2009-07-03T00:00:00+00:00 which is a DateTime 2009-08-03T00:00:00+00:00 which is a DateTime 2009-09-03T00:00:00+00:00 which is a DateTime 2009-10-03T00:00:00+00:00 which is a DateTime 2009-11-03T00:00:00+00:00 which is a DateTime 2009-12-03T00:00:00+00:00 which is a DateTime

The first event gives a date dtstart because it has no recurrence rules, the second event, which does have a recurrence rule, is changing the type of the dtstart to DateTime. This should be fixed.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A new icalendar data (RFC 2445) gem for Ruby which supports time zones and enumeration of occurrences

Shared Ticket Bins

People watching this ticket

Pages